package edu.bbu.cshu.wmpc.checking;

import edu.bbu.cshu.wmpc.checking.similarity.cosine.CosinSimilarity;
import edu.bbu.cshu.wmpc.checking.similarity.dice.DiceCoefficient;
import edu.bbu.cshu.wmpc.checking.similarity.levenshtein.LevenshteinDistance;
import edu.bbu.cshu.wmpc.core.TestTypes;

/**
 * <ul>
 * <li><b><i>TestFactory</i></b></li>
 * <li style="list-style: none;"></li>
 * <li style="list-style: none;">
 * Enumeration used to instantiate a test performer class.
 * 
 * @author WMPC team
 * </li>
 * </ul>
 */ 
public enum TestFactory {
	/**
	 * <ul>
	 * <li><b><i>INSTANCE</i></b></li>
	 * <li style="list-style: none;"></li>
	 * <li style="list-style: none;">
	 * Ensures that only a single instance of the enumeration exists.
	 * 
	 * </li>
	 * </ul>
	 */
	INSTANCE;
	/**
	 * <ul>
	 * <li><b><i>type</i></b></li>
	 * <li style="list-style: none;"></li>
	 * <li style="list-style: none;">
	 * {@link TestTypes} {@code Object} specifying the type of the test performer class. 
	 * 
	 * </li>
	 * </ul>
	 */
	private TestTypes type;
	/**
	 * <ul style="margin-top: 24px;">
	 * <li><b><i>setTestType</i></b></li>
	 * <li style="list-style: none;"></li>
	 * <li style="list-style: none;">
	 * <p style="margin-left: 7px;">{@code public void setTestType(}{@link TestTypes} {@code type)}</p>
	 * <br>	
	 * Sets the type of the test performer class that will be instantiated.
	 * 
	 * @param type - the type of the test performer class to be instantiated.
	 * </li>
	 * </ul>
	 */
	public void setTestType(TestTypes type) {
		this.type = type;
	}
	/**
	 * <ul style="margin-top: 24px;">
	 * <li><b><i>getTester</i></b></li>
	 * <li style="list-style: none;"></li>
	 * <li style="list-style: none;">
	 * <p style="margin-left: 7px;">{@code public} {@link Checking} {@code getTester()}</p>
	 * <br>	
	 * Returns an instance of the test performer class that was set in {@code type}. 
	 * 
	 * @return an instance of a test performer class that extends the {@code abstract class} {@link Similarity} which implements the interface {@link Checking}   
	 * </li>
	 * </ul>
	 */
	public Checking getTester() {
		switch (type){
			case DICE: return new DiceCoefficient(78);
			case COSINE: return new CosinSimilarity(67);
			case LEVENSHTEIN: return new LevenshteinDistance(86);
		}
		return null;
	}
}

